package com.xbongbong.saas.model.impl;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.saas.domain.dao.WorkPlanDao;
import com.xbongbong.saas.domain.entity.WorkPlanEntity;
import com.xbongbong.saas.model.WorkPlanModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author feng.zheng
 * @version v1.0
 * @date 2019/2/12 20:03
 * @since v1.0
 */
@Service("workPlanModel")
public class WorkPlanModelImpl implements WorkPlanModel {

    @Resource
    private WorkPlanDao workPlanDao;

    /**
     * 工作报告计划数据插入
     *
     * @param entity 工作报告计划实体
     * @return Integer
     * @throws XbbException 异常
     * @author feng.zheng
     * @date 2019-02-12 15:48
     */
    @Override
    public Integer insert(WorkPlanEntity entity) throws XbbException {
        return workPlanDao.insert(entity);
    }

    /**
     * 工作报告计划数据更新
     *
     * @param entity 工作报告计划实体
     * @return Integer
     * @throws XbbException 异常
     * @author feng.zheng
     * @date 2019-02-12 15:48
     */
    @Override
    public Integer update(WorkPlanEntity entity) throws XbbException {
        return workPlanDao.update(entity);
    }

    /**
     * 工作报告计划数据查询多个
     *
     * @param param 参数
     * @return List<WorkReportCcEntity>
     * @throws XbbException 异常
     * @date 2019-02-12 15:48
     */
    @Override
    public List<WorkPlanEntity> findEntitys(Map<String, Object> param) {
        return workPlanDao.findEntitys(param);
    }

    /**
     * 工作报告计划数据查询条数
     *
     * @param param 参数
     * @return Integer
     * @throws XbbException 异常
     * @date 2019-02-12 15:48
     */
    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return workPlanDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    /**
     * 工作报告计划数据单条查询
     *
     * @param key    主键ID
     * @param corpid 公司ID
     * @return Integer
     * @throws XbbException 异常
     * @date 2019-02-12 15:48
     */
    @Override
    public WorkPlanEntity getByKey(Long key, String corpid) {
        return null;
    }

    /**
     * 批量更新计划状态
     *
     * @param status   状态
     * @param corpid   公司id
     * @param userId   员工id
     * @param planIdIn 计划id
     * @return kaka
     * 2016年12月15日 下午8:08:13
     */
    @Override
    public Integer batchUpdateStatus(Integer status, String corpid, String userId, List<Long> planIdIn) {
        return workPlanDao.batchUpdateStatus(status, corpid, userId, planIdIn);
    }

    /**
     * 编辑content
     *
     * @param corpid  公司id
     * @param planId  计划id
     * @param content 内容
     * @return kaka
     * 2016年12月15日 下午9:38:37
     */
    @Override
    public Integer updateContent(String corpid, Long planId, String content) {
        return workPlanDao.updateContent(corpid, planId, content);
    }

    @Override
    public Integer batchDeleteBykey(String corpid, String userId, List<Long> planIdIn) {
        return workPlanDao.batchDeleteBykey(corpid, userId, planIdIn);
    }

    @Override
    public Integer deleteByReportIdIn(List<Long> reportIdIn, String corpid) {
        return workPlanDao.deleteByReportIdIn(reportIdIn, corpid);
    }
}
